//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.lyq.bean.mySql;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class AddC_Sql {
    public AddC_Sql() {
    }

    public Boolean addC_Sql(String No, String name, String time, String place, String credit, String teacher,String limitnum,String courseType, String campus, String category,int major_id,int year_id) {
        (new MysqlLinking()).getLink();
        Connection conn = MysqlLinking.conn;
        Boolean bool = false;

        try {
            String sql = "insert into course(C_No,C_Name,C_Time,C_Place,C_Credit,C_Teacher_ID,C_LimitNum,C_ResidueNum,course_type,campus,category,course_classification,major_id,year_id,is_required) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
            PreparedStatement ps = conn.prepareStatement(sql);
            ps.setString(1, No);
            ps.setString(2, name);
            ps.setString(3, time);
            ps.setString(4, place);
            ps.setString(5, credit);
            ps.setString(6, teacher);
            ps.setString(7, limitnum);
            ps.setString(8, "0");//默认0
            ps.setString(9, courseType);
            ps.setString(10, campus);
            ps.setString(11, category);
            ps.setString(12, ""); // 默认空的
            ps.setInt(13, major_id); // 新增的课程分类字段
            ps.setInt(14, year_id);
            ps.setInt(15, 0);//默认0
            int rs = ps.executeUpdate();
            if (rs > 0) {
                bool = true;
            }

            ps.close();
        } catch (Exception var13) {
            Exception e = var13;
            e.printStackTrace();
        }

        return bool;
    }

}